<?php

namespace App\Models\Divide;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CitySplitRatio extends Model
{
    use HasFactory;
    protected $primaryKey = 'ratio_id';
    public $timestamps  = false;
    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format('Y/m/d H:i:s');
    }
    protected $guarded = [];
    // 定义子城市关系
    public function children()
    {
        return $this->hasMany(CitySplitRatio::class,'pid' ,'area_code');
    }

    // 定义父城市关系
    public function parent()
    {
        return $this->belongsTo(CitySplitRatio::class, 'pid');
    }
}
